documentation: http://pandas.pydata.org/pandas-docs/stable/basics.html
In [7]:
import pandas as pd
import numpy as np
In [8]:
my_dictionary = {'a' : 45., 'b' : -19.5, 'c' : 4444}
my_series = pd.Series(my_dictionary)
my_series
Out[8]:
In [9]:
my_series + my_series
Out[9]:
In [10]:
my_series
Out[10]:
In [11]:
my_series + 5
Out[11]:
In [12]:
np.exp(my_series)
Out[12]:
A key difference between Series and ndarray is that operations between Series automatically align the data based on label. Thus, you can write computations without giving consideration to whether the Series involved have the same labels.
In [13]:
my_series[1:]
Out[13]:
In [14]:
my_series[:-1]
Out[14]:
In [15]:
my_series[1:] + my_series[:-1]
Out[15]:
In [16]:
def multiply_by_ten (input_element):
return input_element * 10.0
In [17]:
my_series.map(multiply_by_ten)
Out[17]:
In [18]:
series_of_strings = pd.Series(['A', 'B', 'C', 'Aaba', 'Baca', np.nan, 'CABA', 'dog', 'cat'])
In [19]:
series_of_strings.str.lower()
Out[19]:
In [ ]: